////////////////////////////////////////////////////////////////
// filename: particle.h
// description: header file for the particle class
// author: Jay Tomten (jaytomten@gmail.com)
// notes:

// namespace
using namespace std;

// defines
#ifndef __PARTICLE__
#define __PARTICLE__

// includes
#include "object.h"
#include "vertex.h"
#include "color.h"

// globals

////////////////////////////////////////////////////////////////
// Particle - definition of our particle class
class Particle : public Object {

public:

    Particle();                                     // constructor
    Particle(int type, float x, float y, float z);  // constructor that calls Init()
    ~Particle();                                    // destructor

    void Init(int type, float x, float y, float z); // initialize a particle system
    bool Update(float d);    // update all particles
    void Draw();                             // draw all the particles to the screen

private:

    struct Part {
        Vertex pos;    // position
	    Vertex vel;    // particle speed
	    Color  col;    // particle color
	    Vertex force;  // forces on particle (wind/gravity)
        float  life;   // life of particles
        float  size;   // size of particles
        float  timer;  // a generic timer for particles
    };

    // particle system info
    int   max;               // maximum number of particles
    bool  shimmer;           // are we doing a shimmer/glowing effect

    float playTime;          // how long are we playing this event?
    float playedTime;        // how long have we been playing
    float pps;               // desired particles per seconds
    float ppsVar;            // variation in pps
    Vertex posStart;         // the center of our effect
    Vertex posStartVar;      // variations allowed in starting position
    Vertex posStartChange;   // change in position over time we will start with
    Vertex velStart;         // the velocity we are starting at
    Vertex velVar;           // the variation in starting velocities
    Vertex velChange;        // acceleration
    Color  colStart;         // what color are we starting with
    Color  colVar;           // color variation at start
    Color  colChange;        // color change over time
    Vertex forceStart;       // how much farce are we starting with
    Vertex forceVar;         // acceptable difference in particle weights
    Vertex forceChange;      // how weight changes over time
    float  sizeStart;        // about how big are we starting at
    float  sizeVar;          // size of particle variations at start
    float  sizeChange;       // how size changes over time
    float  lifeStart;        // starting life value of particle
    float  lifeVar;          // variation allowed in life of particles

    // misc
    Part *pArray;            // our array of particle info
    int   last;              // the last active position in our particle array
    bool  alive;             // is the particle system still alive?

    // functions
    bool Empty();            // is the array empty?
    bool Full();             // is the array full?
    void Add();              // add a particle
    void Delete(int i);      // delete a particle
    

};

#endif






